package com.chunuo.eduservice.controller.front;

import com.chunuo.eduservice.entity.EduCourse;
import com.chunuo.eduservice.entity.EduTeacher;
import com.chunuo.eduservice.service.EduCourseService;
import com.chunuo.eduservice.service.EduTeacherService;
import com.chunuo.commonutils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 类的作用
 *
 * @author liujiamiao
 * @email 2544296058@qq.com
 * @date 2020-07-18 22:00
 */
@RestController
@RequestMapping("/eduservice/indexfront")
public class IndexFrontController {

    @Autowired
    private EduCourseService courseService;

    @Autowired
    private EduTeacherService teacherService;

    //查询前8条热门课程，查询前4条名师
    @GetMapping("index")
    public R index() {
        List<EduCourse> courseList = courseService.popularCourse();
        List<EduTeacher> teacherList = teacherService.popularTeacher();
        return R.ok().data("courseList",courseList).data("teacherList",teacherList);
    }

}
